import request from '@/utils/request'

// 查询通道列表
export function listChannel(query) {
  return request({
    url: '/iot/channel/list',
    method: 'get',
    params: query
  })
}

// 查询通道详细
export function getChannel(id) {
  return request({
    url: '/iot/channel/' + id,
    method: 'get'
  })
}

// 新增通道
export function addChannel(data) {
  return request({
    url: '/iot/channel',
    method: 'post',
    data: data
  })
}

// 修改通道
export function updateChannel(data) {
  return request({
    url: '/iot/channel',
    method: 'put',
    data: data
  })
}

// 删除通道
export function delChannel(id) {
  return request({
    url: '/iot/channel/' + id,
    method: 'delete'
  })
}

// 导出通道
export function exportChannel(query) {
  return request({
    url: '/iot/channel/export',
    method: 'get',
    params: query
  })
}

// 同步国标通道
export function syncChannel() {
  return request({
    url: '/iot/channel/sync',
    method: 'post'
  })
}

// 获取设备-通道树形结构
export function getChannelTree() {
  return request({
    url: '/iot/channel/tree',
    method: 'get'
  })
}

// 开始点播
export function startPlay(deviceId, channelId) {
  return request({
    url: `/iot/channel/play/${deviceId}/${channelId}`,
    method: 'get'
  })
} 